package com.zhy.http.okhttp.builder;

import com.zhy.http.okhttp.request.GetRequest;
import com.zhy.http.okhttp.request.RequestCall;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

public class GetBuilder extends OkHttpRequestBuilder
{
  private String appendParams(String paramString, Map<String, String> paramMap)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(paramString + "?");
    Iterator localIterator;
    if ((paramMap != null) && (!paramMap.isEmpty()))
      localIterator = paramMap.keySet().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return localStringBuilder.deleteCharAt(-1 + localStringBuilder.length()).toString();
      String str = (String)localIterator.next();
      localStringBuilder.append(str).append("=").append((String)paramMap.get(str)).append("&");
    }
  }

  public GetBuilder addHeader(String paramString1, String paramString2)
  {
    if (this.headers == null)
      this.headers = new LinkedHashMap();
    this.headers.put(paramString1, paramString2);
    return this;
  }

  public GetBuilder addParams(String paramString1, String paramString2)
  {
    if (this.params == null)
      this.params = new LinkedHashMap();
    this.params.put(paramString1, paramString2);
    return this;
  }

  public RequestCall build()
  {
    if (this.params != null)
      this.url = appendParams(this.url, this.params);
    return new GetRequest(this.url, this.tag, this.params, this.headers).build();
  }

  public GetBuilder headers(Map<String, String> paramMap)
  {
    this.headers = paramMap;
    return this;
  }

  public GetBuilder params(Map<String, String> paramMap)
  {
    this.params = paramMap;
    return this;
  }

  public GetBuilder tag(Object paramObject)
  {
    this.tag = paramObject;
    return this;
  }

  public GetBuilder url(String paramString)
  {
    this.url = paramString;
    return this;
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.zhy.http.okhttp.builder.GetBuilder
 * JD-Core Version:    0.6.2
 */